#ifndef OBJ_CLASS
#define OBJ_CLASS

#include <vector>
#include <cmath>
#include"Triangle.h"
#include "../scene/BVH_Node.h"
#include"../scene/Material.h"

namespace disc0ver {
	struct Face{
		Vertex &a,&b,&c;
		vec3<TRANSFORM> normal;
		Face(Vertex& aa,Vertex& bb,Vertex& cc):a(aa),b(bb),c(cc) {
			normal = cross(bb.pos - aa.pos,cc.pos-aa.pos);
			normal.normalize();
		}
	};
	class CObj:public Hitable{
	public:
		CObj()=default;
		~CObj()=default;
		CObj(const char* pcszFileName, std::shared_ptr<Material> ma);
		Scene* faces;
		bool hit(const Ray& r, double t_min, double t_max, hit_record& rec) const
		{
			return faces->hit(r, t_min, t_max, rec);
		}
		bool bounding_box(AABB& output_box) const override {
			return faces->bounding_box(output_box);
		}
	};
}
#endif

